<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <title>WebSocket Client</title>
</head>
<body>
<div id="All">
  <el-button @click="sendName">发送姓名</el-button>
  <el-button @click="getState">获取状态</el-button>
  <el-button @click="test">test</el-button>
  <el-button @click="sendMsg">发送消息</el-button>
  <el-button @click="getMsg">获取消息</el-button>
</div>
<script>
  vm=new Vue({
    el:"#All",
    data:{
      userName:'',
      gameId:'',
      msg:'',
      send_Msg:''
    },
    methods:{
      test(){
        axios({
          method: 'get',
          url: 'http://localhost:80/match/Bihar/nihap/你哈/我',
          data: {

          }
        }).then(function (res){
          let m=res.data;

          if(m.op=="wait"){
            vm.msg="waiting";
          }else if (m.op=="success"){
            vm.msg="gameId:"+m.gameId;
            vm.gameId=m.gameId;
          }else if(m.op=="alreadyHaveUser"){
            vm.msg="alreadyHaveUser";
          }
        });
      },
      sendName(){
        axios({
          method: 'post',
          url: 'http://localhost:80/T_match',
          data: {

          }
        }).then(function (res){

        });
      },
      getState(){
        axios({
          method: 'post',
          url: 'http://localhost:80/T_match',
          data: {

          }
        }).then(function (res){

        });

      },
      sendMsg(){
        axios({
          method: 'post',
          url: 'http://localhost:80/T_game',
          data: {

          }
        }).then(function (res){

        });
      },
      getMsg(){
        axios({
          method: 'post',
          url: 'http://localhost:80/T_game',
          data: {

          }
        }).then(function (res){

        });
      }
    }
  })
</script>
</body>
</html>
